/* Tabs bar  */

@namespace xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

:root[tabsintitlebar] #nav-bar toolbaritem,
#nav-bar-customization-target {
	-moz-window-dragging: drag;
}

#tabbrowser-tabs[haspinnedtabs]:not([positionpinnedtabs]):not([orient="vertical"]) > #tabbrowser-arrowscrollbox > .tabbrowser-tab:nth-child(1 of :not([pinned], [hidden])) {
	margin-inline-start: 6px !important;
}

#TabsToolbar tab > stack {
	margin: 0 3px !important;
}

/* Tabs bar height */
#TabsToolbar #tabbrowser-tabs {
	--tab-min-height: 32px !important;
	--tabstrip-min-height: 32px !important;
}

#TabsToolbar .tab-background,
#TabsToolbar .tab-stack {
	height: 32px !important;
	min-height: 32px !important;
}

.tabbrowser-tab,
.tab-background {
	border: none !important;
	box-shadow: none !important;
	border-radius: 8px !important;
	padding: 0 !important;
	background-image: none !important;
}

.tabbrowser-tab:not([visuallyselected="true"], [multiselected]), .tabbrowser-tab:-moz-lwtheme {
	color: var(--gnome-tabbar-tab-color) !important;
}

.tabbrowser-tab .tab-background:not([selected=true]) {
	color: var(--gnome-tabbar-tab-active-color) !important;
}

.tab-background {
	background: transparent !important;
	transition: background-color 200ms !important;
	outline: none !important;
}

#TabsToolbar .tab-background {
	margin: 0 !important;
}

.tabbrowser-tab:not([selected=true]) .tab-background {
	background: var(--gnome-tabbar-tab-background) !important;
}

.tabbrowser-tab:not([selected=true]) .tab-background:-moz-window-inactive {
	background: var(--gnome-inactive-tabbar-tab-background) !important;
}

/* Tab hover */
.tabbrowser-tab:not([selected=true]):hover .tab-background {
	background: var(--gnome-tabbar-tab-hover-background) !important;
}

/* Active tab */
.tab-background:is([selected]) {
	background: var(--gnome-tabbar-tab-active-background) !important;
}

.tab-background:is([selected]):-moz-window-inactive {
	background: var(--gnome-inactive-tabbar-tab-active-background) !important;
}

/* Tab labels */
tab .tab-label {
	color: var(--gnome-tabbar-tab-color) !important;
}
tab:hover .tab-label {
	color: var(--gnome-tabbar-tab-hover-color) !important;
}
tab[selected] .tab-label {
	color: var(--gnome-tabbar-tab-active-color) !important;
}
tab:-moz-window-inactive .tab-label {
	color: var(--gnome-inactive-tabbar-tab-color) !important;
}
tab[selected]:-moz-window-inactive .tab-label {
	color: var(--gnome-inactive-tabbar-tab-active-color) !important;
}

.close-icon {
	height: 16px !important;
	padding: 0 !important;
	width: 16px !important;
}

.tab-close-button {
	-moz-appearance: none !important;
	margin-inline-end: 0 !important;
	border: none !important;
	box-sizing: content-box; /* Avoid deformation on flexbox */
	border-radius: 3px !important;
	list-style-image: url("../icons/window-close-symbolic.svg") !important;
	height: 16px;
	opacity: .3;
	padding: 0;
	width: 16px;
}

.tabbrowser-tab > .tab-stack > .tab-content > .tab-close-button {
	visibility: hidden;
}

.tabbrowser-tab:hover > .tab-stack > .tab-content > .tab-close-button {
	visibility: visible;
}
:root:-moz-window-inactive .tab-close-button:not(#hack) {
	opacity: .18 !important;
}
:root:not(:-moz-window-inactive) .tab-close-button:hover {
	background-color: var(--gnome-button-hover-color) !important;
	border: none !important;
	opacity: 1;
}
:root:not(:-moz-window-inactive) .tab-close-button:active {
	background-color: var(--gnome-button-active-color) !important;
}

.tab-close-button:active:not(:hover) {
	background-image: none !important;
	box-shadow: none !important;
}

/* Tab close button etc. positioning */
.tab-throbber, .tab-icon-image, .tab-sharing-icon-overlay, .tab-icon-sound, .tab-close-button {
	margin-top: 0 !important;
}

.tabbrowser-tab[soundplaying="true"] .tab-icon-image,
.tabbrowser-tab[muted="true"] .tab-icon-image {
	margin-top: 3px !important;
	margin-left: 2px !important;
}

.tab-icon-overlay {
	height: 24px !important;
	width: 24px !important;
	padding: 4px !important;
	border-radius: 100px !important;
}

.tab-icon-overlay:not([crashed]):is([pinned], [sharing]) {
	top: 0 !important;
	inset-inline-end: 0 !important;
}

.button-background {
  &[type~="icon"]:not(.labelled), &:not(.labelled):has(img) {
    &[size="small"] {
      margin-bottom: 3px !important;
    }
  }
}

.tabbrowser-tab .tab-icon-overlay:not([crashed]):is([soundplaying], [muted], [activemedia-blocked]) {
	background-color: transparent !important;
}

.tabbrowser-tab[selected=true] .tab-icon-overlay:not([crashed]):is([soundplaying], [muted], [activemedia-blocked]) {
	background-color: transparent !important;
}

.tabbrowser-tab .tab-icon-overlay:not([crashed]):is([soundplaying], [muted], [activemedia-blocked]):hover {
	background-color: var(--gnome-tabbar-tab-hover-background) !important;
}

/* Remove blue line above tabs */
.tab-line {
	display: none;
}

/* tab-context-line above tabs */
.tabbrowser-tab[usercontextid] > .tab-stack > .tab-background > .tab-context-line {
	height: 2px;
	border-radius: 2px;
	margin: 0 12px !important;
}

/* Remove alt colours references for multi tabs*/
.tabbrowser-tab[usercontextid] > .tab-stack > .tab-background > .tab-bottom-line {
	display: none;
}

/* Tab attention dot */
.tabbrowser-tab:is([image], [pinned]) > .tab-stack > .tab-content[attention]:not([selected="true"]), .tabbrowser-tab > .tab-stack > .tab-content[pinned][titlechanged]:not([selected="true"]), #firefox-view-button[attention] {
	background-image: radial-gradient(circle, var(--gnome-tab-attention-icon-color), var(--gnome-tab-attention-icon-color) 2px, transparent 2px) !important;
	background-position: center bottom 3px !important;
	background-size: 4px 4px;
	background-repeat: no-repeat;
}

.tabbrowser-tab[class*="identity-color-"][pinned] {
	display: flex;
}

#TabsToolbar #alltabs-button {
	padding: 0 !important;
	visibility: collapse !important;
}

#TabsToolbar .toolbarbutton-1,
#TabsToolbar #tabs-newtab-button,
#TabsToolbar #new-tab-button {
	margin: 0 2px !important;
	padding: 0 10px !important;
	max-height: 32px !important;
	min-height: 32px !important;
	border-radius: 8px !important;
}

#TabsToolbar .toolbarbutton-1 image,
#TabsToolbar #tabs-newtab-button image,
#TabsToolbar #new-tab-button image {
	margin: 0 !important;
	padding: 0 !important;
	height: 16px !important;
	width: 16px !important;
}

#TabsToolbar #scrollbutton-up,
#TabsToolbar #scrollbutton-down {
	max-height: 32px !important;
	min-height: 32px !important;
}

#TabsToolbar #scrollbutton-up image,
#TabsToolbar #scrollbutton-down image {
	margin: 0 !important;
	padding: 0 !important;
	height: 16px !important;
	width: 16px !important;
}

/* firefox-view-button */
:root:not([privatebrowsingmode="temporary"]):not([firefoxviewhidden]) :is(#firefox-view-button, #wrapper-firefox-view-button) {
	display: none !important;
}

:root:not([privatebrowsingmode], [firefoxviewhidden]) :is(toolbarbutton, toolbarpaletteitem) + #tabbrowser-tabs, :root[privatebrowsingmode]:not([firefoxviewhidden]) :is(toolbarbutton:not(#firefox-view-button), toolbarpaletteitem:not(#wrapper-firefox-view-button)) + #tabbrowser-tabs {
	border-inline-start: none !important;
}

#firefox-view-button > .toolbarbutton-icon {
	filter: none !important;
	box-shadow: none !important;
	outline: none !important;
}

/* Remove shadow next to tab scroll buttons */
.arrowscrollbox-overflow-start-indicator,
.arrowscrollbox-overflow-end-indicator {
	display: none;
}
